abstract class Employee {
    protected String name;
    protected double salary;

    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public abstract double calculateSalary();
}
class SalariedEmployee extends Employee {
    public SalariedEmployee(String name, double salary) {
        super(name, salary);
    }

    @Override
    public double calculateSalary() {
        return salary;
    }
}
class HourlyEmployee extends Employee {
    private double hoursWorked;

    public HourlyEmployee(String name, double salary, double hoursWorked) {
        super(name, salary);
        this.hoursWorked = hoursWorked;
    }

    @Override
    public double calculateSalary() {
        return salary * hoursWorked;
    }
}

public class Employeemain {
    public static void main(String[] args) {
        Employee[] employees = new Employee[10];
        String[] names = {"张三", "李四", "王五", "赵六", "孙七"};
        double[] salariedSalaries = {5000.0, 6000.0, 7000.0, 8000.0, 9000.0};
        double[] hourlySalaries = {20.0, 25.0, 30.0, 35.0, 40.0};
        double maxHours = 160.0;
        for (int i = 0; i < 10; i++) {
            int randomType = (int) (Math.random() * 2);
            if (randomType == 0) {
                int randomNameIndex = (int) (Math.random() * 5);
                int randomSalaryIndex = (int) (Math.random() * 5);
                employees[i] = new SalariedEmployee(names[randomNameIndex], salariedSalaries[randomSalaryIndex]);
            } else {
                int randomNameIndex = (int) (Math.random() * 5);
                int randomSalaryIndex = (int) (Math.random() * 5);
                double hours = Math.random() * maxHours;
                employees[i] = new HourlyEmployee(names[randomNameIndex], hourlySalaries[randomSalaryIndex], hours);
            }
        }
        for (Employee employee : employees) {
            System.out.println(employee.name + " 的工资是: " + employee.calculateSalary() + " 元");
        }
    }
}